package com.nulldev.util.web.nTube.util;

import com.nulldev.util.data.Variables;
import com.nulldev.util.web.YouTubeExtractor.formats.AudioCodec;
import com.nulldev.util.web.YouTubeExtractor.formats.VideoCodec;

public class VideoPageUtil {

	@SuppressWarnings("deprecation")
	public static String getAudioCodecType(final AudioCodec codec) {
		switch (Variables.requireNonNullObject(codec, "codec")) {
			case NONE:
				return "NONE";
			case AAC:
				return "MPEG4/AAC";
			case MPEG3:
				return "MPEG3";
			case OPUS:
				return "WEBM/OPUS";
			case VORBIS:
				return "WEBM/VORBIS";
			case AC3:
				return "MPEG4/AC3";
			case EAC3:
				return "MPEG4/EAC3";
			case DCA:
				return "MPEG4/DTS";
			default:
				throw new UnsupportedOperationException("getCodecType: Unknown AudioCodec: " + codec);
		}
	}

	@SuppressWarnings("deprecation")
	public static String getVideoCodecType(final VideoCodec codec) {
		switch (Variables.requireNonNullObject(codec, "codec")) {
			case NONE:
				return "NONE";
			case H264:
				return "MPEG4/H.264";
			case AV1:
				return "MPEG4+WEBM/AV1";
			case H263:
			case MPEG4:
				return "3GPP/MPEG4";
			case H265:
				return "MPEG4/H.265";
			case VP8:
			case VP9:
				return "WEBM/VP8+9";
			default:
				throw new UnsupportedOperationException("getCodecType: Unknown VideoCodec: " + codec);
		}
	}
}
